home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / restartIPServer / RCS / restartIPServer,v < prev    next >
Encoding:
Text File  |  1992-07-17  |  4.7 KB  |  226 lines

  1. head     1.6;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @# @;
  7.  
  8.  
  9. 1.6
  10. date     92.07.17.11.55.58;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.5;
  13.  
  14. 1.5
  15. date     92.07.17.11.48.24;  author mottsmth;  state Exp;
  16. branches ;
  17. next     1.4;
  18.  
  19. 1.4
  20. date     91.08.14.14.46.10;  author kupfer;  state Exp;
  21. branches ;
  22. next     1.3;
  23.  
  24. 1.3
  25. date     91.08.11.14.27.54;  author kupfer;  state Exp;
  26. branches ;
  27. next     1.2;
  28.  
  29. 1.2
  30. date     90.11.12.12.11.58;  author kupfer;  state Exp;
  31. branches ;
  32. next     1.1;
  33.  
  34. 1.1
  35. date     90.11.09.14.10.24;  author kupfer;  state Exp;
  36. branches ;
  37. next     ;
  38.  
  39.  
  40. desc
  41. @Common code to kill off and restart the IP server and any dependent
  42. daemons.  Originally /hosts/allspice/restartIPServer.
  43. @
  44.  
  45.  
  46. 1.6
  47. log
  48. @Don't start up bootp on the root server.
  49. @
  50. text
  51. @#!/bin/csh -f
  52. #
  53. # Script to kill off and restart the IP server and any dependent
  54. # daemons.
  55. #
  56. # Usage: restartIPServer [ -r ]
  57. #
  58. # where "-r" means to start up processes that run only on the root
  59. #          server.
  60. #
  61. # $Header: /sprite/src/admin/restartIPServer/RCS/restartIPServer,v 1.5 92/07/17 11:48:24 mottsmth Exp Locker: kupfer $
  62.  
  63. # This script is a bit ugly, because it could conceivably kill processes
  64. # that happen to have server names in the command line.
  65.  
  66. set rootFlag="no"
  67.  
  68. set args = `getopt "r" $*`
  69. while ("X$args[1]" != "X--")
  70.     switch ($args[1])
  71.     case '-r':
  72.         set rootFlag="yes"
  73.         breaksw
  74.     endsw
  75.     shift args
  76. end
  77.  
  78. # If the user didn't ask for root server daemons, try to deduce
  79. # whether we're running on the root server anyway.
  80. # Remove domain stuff from host names when comparing them.
  81.  
  82. set rootServer=`prefix -p | grep "/ " | awk '{ print $2 }' | sed -e s/\\..\*//`
  83. set ourName=`hostname | sed -e s/\\..\*//`
  84. if ($rootServer == $ourName) then
  85.     set rootFlag="yes"
  86. endif
  87.  
  88. # Use /sprite/cmds/kill instead of the builtin "kill".  If we use the
  89. # builtin and then clients go away before we can kill them (easy to do
  90. # if any clients depend on other clients), the script exits right
  91. # there.
  92.  
  93. set pid=`ps -a | egrep ipServer | awk '{print $1}'`
  94. set clients=`ps -a | egrep 'portmap|unfsd|sendmail|inetd|tftpd|bootp|lpd' | awk '{print $1}'`
  95. if ("X$pid" != "X" || "X$clients" != "X") then
  96.     echo "Killing ipServer ($pid) and clients ($clients)" > /dev/syslog
  97.     /sprite/cmds/kill -KILL $clients $pid
  98. endif
  99.  
  100. # Restart the servers that were killed off above.  
  101. #
  102. # This code is cloned from /boot/bootcmds.  It would be better if both
  103. # scripts shared a common "start servers" script.
  104.  
  105. set host = `hostname`
  106. echo -n "Restarting server daemons: "
  107.  
  108. echo -n "IP server "
  109. rm -f /hosts/$host/{X0,netIP,netUDP,netTCP,debug}
  110. if (-e /hosts/$host/ipStart) then
  111.     /hosts/$host/ipStart
  112. else
  113.     if ($rootFlag == "yes") then
  114.         /sprite/daemons/ipServer.dbg >>& /hosts/$host/ip.out
  115.     else
  116.         /sprite/daemons/ipServer >>& /hosts/$host/ip.out
  117.     endif
  118. endif
  119. rm -f /hosts/$host/rlogin* >& /dev/null
  120. sleep 2
  121.  
  122. echo -n "inetd "
  123. /sprite/daemons/inetd /sprite/daemons/inetd.conf
  124.  
  125. echo -n "sendmail "
  126. if ($rootFlag == "yes") then
  127.     sendmail -bd -q15m
  128. else
  129.     sendmail -bd
  130. endif
  131.  
  132. echo -n "lpd "
  133. /sprite/daemons/lpd
  134.  
  135. if ($rootFlag == "yes") then
  136.     # There shouldn't be any need to restart arpd.
  137.     # bootp is now running on lust.
  138.  
  139.     echo -n "tftp "
  140.     /sprite/daemons/tftpd
  141.     
  142. endif
  143.  
  144. echo "."
  145.  
  146. if (-e /hosts/$host/nfs) then
  147.     echo "NFS/Sprite gateway: "
  148.     /hosts/$host/nfs
  149. endif
  150. @
  151.  
  152.  
  153. 1.5
  154. log
  155. @temporary debugging stuff
  156. @
  157. text
  158. @d11 1
  159. a11 1
  160. # $Header: /sprite/src/admin/restartIPServer/RCS/restartIPServer,v 1.4 91/08/14 14:46:10 kupfer Exp Locker: mottsmth $
  161. d87 1
  162. a91 3
  163.     echo -n "bootp "
  164.     rm -f /usr/adm/bootplog
  165.     /sprite/daemons/bootp
  166. @
  167.  
  168.  
  169. 1.4
  170. log
  171. @nfsmount nows knows what to do when the IP server dies, so don't kill it.
  172. @
  173. text
  174. @d11 1
  175. a11 1
  176. # $Header: /sprite/src/admin/restartIPServer/RCS/restartIPServer,v 1.3 91/08/11 14:27:54 kupfer Exp Locker: kupfer $
  177. d63 5
  178. a67 1
  179.     /sprite/daemons/ipServer >>& /hosts/$host/ip.out
  180. @
  181.  
  182.  
  183. 1.3
  184. log
  185. @Running on the root server implies "-r".
  186. @
  187. text
  188. @d11 1
  189. a11 1
  190. # $Header: /sprite/src/admin/restartIPServer/RCS/restartIPServer,v 1.2 90/11/12 12:11:58 kupfer Exp Locker: kupfer $
  191. d44 1
  192. a44 1
  193. set clients=`ps -a | egrep 'nfsmount|portmap|unfsd|sendmail|inetd|tftpd|bootp|lpd' | awk '{print $1}'`
  194. @
  195.  
  196.  
  197. 1.2
  198. log
  199. @Remove outdated comments about (non-existent) -n switch.
  200. @
  201. text
  202. @d11 1
  203. a11 1
  204. # $Header: /sprite/src/admin/restartIPServer/RCS/restartIPServer,v 1.1 90/11/09 14:10:24 kupfer Exp Locker: kupfer $
  205. d13 1
  206. a13 1
  207. # This is a bit ugly, because it could conceivably catch processes
  208. d27 10
  209. @
  210.  
  211.  
  212. 1.1
  213. log
  214. @Initial revision
  215. @
  216. text
  217. @d6 1
  218. a6 1
  219. # Usage: restartIPServer [ -rn ]
  220. a9 1
  221. #       "-n" means to export the Sprite filesystem to NFS.
  222. d11 1
  223. a11 1
  224. # $Header: /hosts/allspice.Berkeley.EDU/RCS/restartIPServer,v 1.2 90/10/17 12:34:21 kupfer Exp Locker: kupfer $
  225. @
  226.